package com.zjgk.hotel.controller;

import com.alibaba.fastjson.JSONObject;

import com.zjgk.hotel.service.UserService;
import com.zjgk.hotel.vo.Result;
import com.zjgk.hotel.vo.params.WxUserLoginParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.http.converter.StringHttpMessageConverter;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;

@RestController
@RequestMapping("/user")
@Validated
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/userinfo")
    public Result userInfo(){
        return userService.userInfo();
    }

    @PostMapping("/wx/login")
    public Result WxLogin(@Valid @ModelAttribute WxUserLoginParams user){
        return userService.wxUserLogin(user);
    }




}
